/*
* @Author: monster
* @Date:   2017-09-21 16:00:04
* @Last Modified by:   monster
* @Last Modified time: 2017-09-22 01:03:15
*/
'use strict';
angular.module('app').controller('postCtrl', ['$http', '$scope', function($http, $scope){
	// 定义标签页数据
	$scope.tabList = [{
	    id: 'all',
	    name: '全部'
	  }, {
	    id: 'pass',
	    name: '面试邀请'
	  }, {
	    id: 'fail',
	    name: '不合适'
	}];
	$http.get('data/myPost.json').success(function(resp){
		$scope.positionList = resp;
	});
	// 初始化过滤对象
	$scope.filterObj = {};
	// 定义点击标签会执行的方法
	$scope.tClick = function(id, name) {
	// 根据传入的id匹配对应的过滤条件
    switch (id) {
    	// 全部
      case 'all':
      	// 则删除过滤条件
        delete $scope.filterObj.state;
        break;
        // 面试邀请
      case 'pass':
        $scope.filterObj.state = '1';
        break;
        // 不合适
      case 'fail':
        $scope.filterObj.state = '-1';         
        break;
      default:
    }
  }
}]);